package homework.day12;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ProductTest {
    public static void main(String[] args) {
        List<Product> list=new ArrayList<>();
       Product p=new Product(1,"水",45.3,"大连");
       Product p1=new Product(2,"面包",56.3,"苏州");
       Product p2=new Product(3,"泡面",100.3,"上海");
       Product p3=new Product(4,"香肠",452.3,"杭州");
       Product p4=new Product(4,"啤酒",789.3,"大连");
       list.add(p);
       list.add(p1);
       list.add(p2);
       list.add(p3);
       list.add(p4);
        System.out.println(list);
        System.out.println(list.get(2));
       list.remove(1);
        System.out.println(list);
        list.get(2).setPrice(list.get(2).getPrice()*1.5);
        System.out.println("=============================="+list.get(2));
        Iterator<Product> ite=list.iterator();
        while (ite.hasNext()){
            System.out.println( ite.next());


        }
        System.out.println("===============");

        for (Product q:list){
            System.out.println(q);

        }


    }
}
